<template>
  <div>
    <van-tabbar :route="true" active-color="#f66" inactive-color="#767" v-model="active">
      <van-tabbar-item to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/sorts"  icon="search">分类</van-tabbar-item>
      <van-tabbar-item to="/Cart" :badge="cart.items.length===0?'':cart.items.length" icon="friends-o">购物车</van-tabbar-item>
      <van-tabbar-item  to="/mine" icon="setting-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  data () {
    return {
      active: 0
    }
  },
  computed: {
    ...mapState({
      cart: state => state.cart.cart
    })
  }
}
</script>

<style lang="scss" scoped>
</style>
